home *** CD-ROM | disk | FTP | other *** search
/ Complete Linux / Complete Linux.iso / docs / system / mail / delivery / deliver.tz / deliver / Makefile < prev    next >
Encoding:
Makefile  |  1992-12-07  |  4.6 KB  |  214 lines

  1. # $Header: Makefile,v 2.7 90/05/09 12:26:11 chip Exp $
  2. #
  3. # Makefile for deliver
  4. #
  5. #  +----------------+
  6. #  | Things to make |
  7. #  +----------------+
  8. #
  9. #       deliver         Compile and link the deliver program.
  10. #       header          Compile and link the header program.
  11. #       install         Install deliver and header.  (You must be root.)
  12. #       lint            Run lint on all sources, creating lint.out.
  13. #       shar            Create distribution sharchives.
  14. #       clean           Clean up.
  15. #       clobber         Remove everything that can be regenerated.
  16. #
  17. #  +---------------+
  18. #  | Configuration |
  19. #  +---------------+
  20. #
  21. # SHELL
  22. #       I don't have to tell you...
  23. #
  24. # COPY
  25. #       Your local copy program.  SCO Xenix users may want to change this
  26. #       to "copy -m" which preserves file modification time.
  27. #
  28. # SHAR
  29. #       Your local sharchive generator.
  30. #
  31. # CC
  32. #       Your favorite C compiler.
  33. #
  34. # CFLAGS
  35. #       Compile-time flags to cc.
  36. #       For BSD systems, include "-DBSD".
  37. #       For USG (System III and System V) systems, include "-DUSG".
  38. #       For Xenix systems, don't define anything.
  39. #
  40. # LDFLAGS
  41. #       Link-time flags to cc.  The -i flag creates pure (sharable) code.
  42. #
  43. # LIBS
  44. #       Depending on your environment, you may or may not need to link
  45. #       with "-lx".  SCO Xenix System V needs it; Altos Xenix doesn't.
  46. #
  47. # LINT
  48. #    Your favorite lint program, with flags.
  49. #
  50. # BIN
  51. #       Target directory for installation; /usr/bin is recommended.
  52. #       You may use /usr/local/bin (or whatever), but if you do,
  53. #       be sure that the directory you choose is in your SAFEPATH
  54. #       as defined in config.h.
  55. #
  56. # DELSHAR
  57. #       Basename of sharchives created by "make shar".
  58. #
  59.  
  60. SHELL = /bin/sh
  61. COPY =  cp
  62. SHAR =  shar
  63. CC = gcc
  64. CFLAGS = -O -DUSG
  65. LDFLAGS = -i
  66. LIBS =
  67. LINT = lint -x
  68. BIN =   /usr/bin
  69. DELSHAR =  deliver.sh
  70. STRIP = strip
  71.  
  72. #
  73. # The files that make up the deliver distribution.
  74. #
  75.  
  76. DOCS =  README deliver.8
  77. MF   =  Makefile
  78.  
  79. HDRS =  config.h context.h deliver.h dest.h patchlevel.h misc.h
  80.  
  81. DELSRC1 = addr.c context.c copymsg.c
  82. DELSRC2 = debug.c dest.c dfile.c lock.c log.c main.c
  83. DELSRC3 = mbox.c procs.c subs.c sysdep.c uucp.c
  84. DELYY   = unctime.y
  85. DELYC   = unctime.c
  86. DELSRCY = $(DELSRC1) $(DELSRC2) $(DELSRC3) $(DELYY)
  87. DELSRCC = $(DELSRC1) $(DELSRC2) $(DELSRC3) $(DELYC)
  88. UIDSRCS = uid.c
  89. HDRSRCS = header.c
  90. COMSRCS = getopt.c
  91. SAMPLES = samples samples/*
  92.  
  93. DELOBJS = addr.o context.o copymsg.o debug.o dest.o dfile.o lock.o \
  94.       log.o main.o mbox.o procs.o subs.o sysdep.o unctime.o uucp.o
  95. UIDOBJS = uid.o
  96. HDROBJS = header.o
  97. COMOBJS = getopt.o
  98.  
  99. #
  100. # For GNU Make.  Sorry about the ugliness.
  101. #
  102.  
  103. .PHONY: all install lint shar clean clobber
  104.  
  105. #
  106. # The default target.
  107. #
  108.  
  109. all: deliver header uid
  110.  
  111. #
  112. # "make clobber" implies "make clean".
  113. #
  114.  
  115. clobber:: clean
  116.  
  117. #
  118. # How to install deliver and associated utilities.
  119. #
  120.  
  121. install: deliver header uid
  122.     @if [ `./uid -uU | fgrep '(root)' | wc -l` -ne 2 ]; \
  123.     then \
  124.         echo "Sorry!  You must be root to install deliver."; \
  125.         exit 1; \
  126.     fi
  127.     $(STRIP) deliver header
  128.     $(COPY) deliver $(BIN)/deliver
  129.     chown root.mail $(BIN)/deliver
  130.     chmod 4711 $(BIN)/deliver
  131.     $(COPY) header $(BIN)/header
  132.     chmod 755 $(BIN)/header
  133.  
  134. #
  135. # How to compile and link the program.
  136. #
  137.  
  138. deliver: $(DELOBJS) $(COMOBJS)
  139.     $(CC) $(LDFLAGS) -o $@ $(DELOBJS) $(COMOBJS) $(LIBS)
  140. $(DELOBJS): $(HDRS)
  141. unctime.o: unctime.c
  142.  
  143. clean::
  144.     rm -f $(DELOBJS) $(DELYC)
  145. clobber::
  146.     rm -f deliver
  147.  
  148. #
  149. # A header parsing program.
  150. #
  151.  
  152. header: $(HDRSRCS) $(COMOBJS)
  153.     $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(HDRSRCS) $(COMOBJS) $(LIBS)
  154.     rm -f $(HDROBJS)
  155.  
  156. clobber::
  157.     rm -f header
  158.  
  159. #
  160. # A little program to check on user and group id's.
  161. # (I wish that the System V "id" program were available everywhere.)
  162. #
  163.  
  164. uid: $(UIDSRCS) $(COMOBJS) config.h
  165.     $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(UIDSRCS) $(COMOBJS) $(LIBS)
  166.     rm -f $(UIDOBJS)
  167.  
  168. clobber::
  169.     rm -f uid
  170.  
  171. #
  172. # Common subroutines
  173. #
  174.  
  175. $(COMOBJS): config.h
  176.  
  177. clean::
  178.     rm -f $(COMOBJS)
  179.  
  180. #
  181. # Look for fuzz.
  182. #
  183.  
  184. lint: deliver.lint header.lint uid.lint
  185.  
  186. deliver.lint: $(HDRS) $(DELSRCC) $(COMSRCS)
  187.     $(LINT) $(DELSRCC) $(COMSRCS) $(LIBS) >$@
  188.  
  189. header.lint: $(HDRSRCS) $(COMSRCS)
  190.     $(LINT) $(HDRSRCS) $(COMSRCS) $(LIBS) >$@
  191.  
  192. uid.lint: config.h $(UIDSRCS) $(COMSRCS)
  193.     $(LINT) $(UIDSRCS) $(COMSRCS) $(LIBS) >$@
  194.  
  195. clean::
  196.     rm -f *.lint
  197.  
  198. #
  199. # Make distribution sharchives.
  200. #
  201.  
  202. shar:   $(DELSHAR).01 $(DELSHAR).02 $(DELSHAR).03 $(DELSHAR).04
  203. $(DELSHAR).01: $(DOCS) $(MF) $(UIDSRCS) $(HDRSRCS) $(COMSRCS) $(SAMPLES)
  204.     $(SHAR) >$@ $(DOCS) $(MF) $(UIDSRCS) $(HDRSRCS) $(COMSRCS) $(SAMPLES)
  205. $(DELSHAR).02: $(HDRS) $(DELSRC1)
  206.     $(SHAR) >$@ $(HDRS) $(DELSRC1)
  207. $(DELSHAR).03: $(DELSRC2)
  208.     $(SHAR) >$@ $(DELSRC2)
  209. $(DELSHAR).04: $(DELSRC3) $(DELYY)
  210.     $(SHAR) >$@ $(DELSRC3) $(DELYY)
  211.  
  212. clobber::
  213.     rm -f $(DELSHAR).??
  214.